<template>
    <div>
        <h1>MyCounter组件</h1>
        <button @click="onBtnClick">+1</button>
    </div>
</template>

<script>
import bus from '../eventBus';
export default{
    props:{
        count:Number,
        state:Boolean,
        pa:String,
        pb:Array,
        pc:Object,
        pd:Date,
        pe:Function,
        pf:[Symbol,String,Object],
        pg:{
            type:String,
            required:true
        },
        ph:{
            type:Number,
            default:100
        },
        pk:{
            validator(value){
                return ['success','danger','warning'].indexOf(value) !== -1
            }
        }
    },
    data(){
        return {
            total:100
        }
    },
    emits:['change'],
    methods:{
        onBtnClick(){
            console.log('子组件被点击了');
            
            this.$emit('change',this.total)
            bus.emit('countChange',this.total)
        }
    }
}
</script>

<style>

</style>